<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<span th:text="${user.name}">gongxincheng</span>
<span th:text="${user.age}">18</span>
</body>
<script th:inline="javascript">

  var name = [[${user.name}]];
  var age = [[${user.age}]];
  alert(name + "：" + age);
</script>
</html>